using Domain;
using ErrorCode;
using MediatR;
using System;

namespace WriteAPI.Command.生产计划
{
    /// <summary>
    /// 扩展的生产计划查询命令 - 支持搜索和高级分页
    /// </summary>
    public class GetProductionPlanExtendedCommand : IRequest<APIPaging<ProductionPlanViewModel>>
    {
        /// <summary>
        /// 页码，从1开始
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页记录数
        /// </summary>
        public int PageSize { get; set; } = 10;

        /// <summary>
        /// 搜索关键词(可搜索计划编号/计划主题)
        /// </summary>
        public string? Keyword { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 关联项目
        /// </summary>
        public string? RelatedProject { get; set; }
    }

    /// <summary>
    /// 生产计划视图模型 - 包含关联的物品描述等信息
    /// </summary>
    public class ProductionPlanViewModel
    {
        /// <summary>
        /// 计划ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 计划编号
        /// </summary>
        public string PlanNumber { get; set; } = string.Empty;

        /// <summary>
        /// 计划主题
        /// </summary>
        public string PlanTheme { get; set; } = string.Empty;

        /// <summary>
        /// 单据日期
        /// </summary>
        public DateTime PlanDate { get; set; }

        /// <summary>
        /// 物品描述(简要)
        /// </summary>
        public string ItemDesc { get; set; } = string.Empty;

        /// <summary>
        /// 是否有更多物品
        /// </summary>
        public bool HasMore { get; set; }

        /// <summary>
        /// 物品总数
        /// </summary>
        public int ItemCount { get; set; }

        /// <summary>
        /// 关联项目
        /// </summary>
        public string RelatedProject { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; } = string.Empty;

        /// <summary>
        /// 销售订单号
        /// </summary>
        public string SalesOrder { get; set; } = string.Empty;

        /// <summary>
        /// 总数量
        /// </summary>
        public decimal TotalQuantity { get; set; }
    }
} 